﻿using System;
using System.Data;
using System.Data.Entity;
using System.Linq;
using Xoohoo.Extensions;
using Xoohoo.Models.InputModels;
using XM = Xoohoo.Models;
using Xoohoo.Repositories.SqlServerEF.Entities;

namespace Xoohoo.Repositories.SqlServerEF
{
    public class UserRepository : IUserRepository
    {
        private readonly XoohooContext _db = new XoohooContext();

        protected DbSet<User> DbSet
        {
            get { return _db.Users; }
        }

        #region IUserRepository 成员

        public XM.User GetItemWithoutPermissions(string name)
        {
            throw new NotImplementedException();
        }

        public XM.User GetItemWithoutPermissions(int userID)
        {
            throw new NotImplementedException();
        }

        public XM.User GetNormalItem(string name)
        {
            throw new NotImplementedException();
        }

        public XM.User GetItem(int userID)
        {
            throw new NotImplementedException();
        }

        public XM.User GetItem(string name)
        {
            throw new NotImplementedException();
        }

        public XM.User GetItemByModuleData(string moduleName, string data)
        {
            throw new NotImplementedException();
        }

        public XM.IPagedList<XM.UserBasic> GetList(XM.UserSearchCriteria criteria, XM.PagingInfo pageingInfo)
        {
            throw new NotImplementedException();
        }

        public XM.User Save(XM.User user)
        {
            throw new NotImplementedException();
        }

        public bool Remove(int userID)
        {
            throw new NotImplementedException();
        }

        public bool ChangeStatus(int userID, XM.UserStatus status)
        {
            throw new NotImplementedException();
        }

        public string GetModuleData(XM.User user, string moduleName)
        {
            throw new NotImplementedException();
        }

        public bool SetModuleData(XM.User user, string moduleName, string data)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IDisposable Members

        private bool disposed = false;

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    _db.Dispose();
                }
            }
            this.disposed = true;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        #endregion
    }
}
